package com.tjetc.view.studentview;

import com.tjetc.proxy.CilentProxy;
import com.zhiyun.domain.Student;
import com.zhiyun.service.StudentService;
import com.zhiyun.vo.AppData;
import com.zhiyun.vo.Result;

import java.util.Scanner;

public class MyInfView {
    StudentService studentService= CilentProxy.getProxyInstance(StudentService.class);
     Scanner scanner=new Scanner(System.in);
    public void start() {
        while (true){
            System.out.println("~~~~~~~~~我的信息界面~~~~~~~~~");
            System.out.println("1.查看信息");
            System.out.println("2.修改个人信息");
            System.out.println("0.返回上一级");
            int i = scanner.nextInt();
            switch (i){
                case 1:
                    selectInf();
                    break;
                case 2:
                    new MyInfView_Update().start();
                    break;
                case 0:
                    return;
                default:
                    break;
            }
        }
    }

    private void selectInf() {
        while (true){
            Result result = studentService.myInfo(AppData.student.getId());
            if (result.getCode()==200){
                Student obj = (Student) result.getObj();
                System.out.println("昵称:"+obj.getNickname());
                System.out.println("姓名:"+obj.getTruename());
                System.out.println("手机号:"+obj.getPhone());
                System.out.println("邮箱:"+obj.getEmail());
                System.out.println("性别:"+obj.getSex());
                System.out.println("生日:"+obj.getBirthday());
                System.out.println("学校:"+obj.getSchool());
                System.out.println("学号:"+obj.getSid());
            }else {
                System.out.println("查询失败~~~");
            }
            break;
        }
    }
}
